<template>
    <div>
        <breadcrumb :router-list="routerList"/>
        <order-btn @reloadFun="reloadFun" />
        <orderTabList :order-data="orderData" @reloadTab="reloadTab" />
        <pagination :total="total" />
    </div>
</template>

<script>
    import breadcrumb from '@/components/breadcrumb.vue'
    import pagination from '@/components/paginationSizeChange.vue'
    import orderTabList from './components/integral-order-tab.vue'
    import orderBtn from './components/order-btn.vue'


    export default {
        name: "integral-order",
        components: {
            breadcrumb,
            orderTabList,
            pagination,
            orderBtn
        },
        data() {
            return {
                routerList: [
                    {
                        path: '',
                        name: '订单管理'
                    },
                    {
                        path: '',
                        name: '积分商城订单'
                    }
                ],
                user_id: '',
                p: 1,
                num: this.$store.state.pageNum,
                total: 0,
                status: 2,
                orderData: [],
                supplier_id: this.$store.state.supplier_id
            }
        },
        created() {
            this.getIntegralOrder()
        },
        methods: {
            async getIntegralOrder() {
                const data = await this.$Http.getIntegralOrder({
                    supplier_id: this.supplier_id,
                    user_id: this.user_id,
                    p: this.p,
                    num: this.num,
                    status: this.status
                })
                console.log(data);
                if(data) {
                    this.total = Number(data.count)
                    this.orderData = data.list
                }
            },
            reloadTab( ) {
                this.getIntegralOrder()
            },
            reloadFun(val) {
                this.status = val.status
                this.supplier_id = val.supplier
                this.getIntegralOrder()
            }
        }
    }
</script>

<style scoped>

</style>
